﻿/**
 * ...
 * @author George Mavchun
 */

package gui.hug.priv;

import flash.display.Shape;
import flash.display.Sprite;

class HUGCheckBoxButtonDisplayState extends Sprite
{
	
	public function new(bgColor : Int, selected : Bool) 
	{
		super();
		addImage(bgColor);
		
		if (selected) {
			addSelectImage();
		}
	}

	private function addImage(bgColor : Int) {
		var shape = new Shape();
		shape.graphics.beginFill(bgColor);
		shape.graphics.drawRect(0, 0, 15, 14);
		shape.graphics.endFill();
		
		shape.graphics.lineStyle(1);
		shape.graphics.moveTo(0, 0);
		shape.graphics.lineTo(14, 0);
		shape.graphics.lineTo(14, 14);
		shape.graphics.lineTo(0, 14);
		shape.graphics.lineTo(0, 0);
		
		addChild(shape);
	}
	
	private function addSelectImage() {
		var shape = new Shape();
		shape.graphics.lineStyle(2);
		shape.graphics.moveTo(3, 3);
		shape.graphics.lineTo(7, 13);
		shape.graphics.lineTo(15, 0);
		addChild(shape);
	}
}